#include <glib.h>

struct test_struct { gint32 gint32_member1;
	gchar  gchar_member2;
	gint8  gint8_member3;
};


int main(int argc, char *argv[])
{
	struct test_struct *tsptr, ts;
	
	ts.gint32_member1 = 32;
	ts.gchar_member2  = 's';
	ts.gint8_member3  = 8;

	tsptr = &ts;

	g_printf("ts.gint32_member1: %d\n", G_STRUCT_MEMBER(gint32, tsptr, 0));
	g_printf("ts.gchar_member2:  %c\n", G_STRUCT_MEMBER(gchar, tsptr, 4));
	g_printf("ts.gint8_member3:  %d\n", G_STRUCT_MEMBER(gint8, tsptr, 5));

	g_printf("ts.gint32_member1: %d\n", *(gint32*)G_STRUCT_MEMBER_P(tsptr, 0));
	g_printf("ts.gchar_member2:  %c\n", *(gchar*)G_STRUCT_MEMBER_P(tsptr, 4));
	g_printf("ts.gint8_member3:  %d\n", *(gint8*)G_STRUCT_MEMBER_P(tsptr, 5));

	g_printf("ts.gint32_member1 offset: %d\n", G_STRUCT_OFFSET(struct test_struct, gint32_member1));
	g_printf("ts.gchar_member2 offset:  %d\n", G_STRUCT_OFFSET(struct test_struct, gchar_member2));
	g_printf("ts.gint8_member3 offset:  %d\n", G_STRUCT_OFFSET(struct test_struct, gint8_member3));

	return 0;
}
